package Lab15;

import java.util.Scanner;


public class Menu {
    public static void menu1() throws Exception {
        System.out.println("**********************************");
        System.out.println("*********   飞机订票系统    ********");
        System.out.println("输入您的操作：");
        System.out.println("         0. Exit   1. Next       ");
        System.out.println("**********************************");
        Scanner sc = new Scanner(System.in);
        int choice = sc.nextInt();
        switch (choice) {
            case 0:
                System.out.println("欢迎下次使用");
                break;
            case 1:
                menu2();
                break;
            default:
                System.out.println("业务尚未开发..........");
                System.out.println("请重新输入...........\n");
                menu1();
        }
    }
    public static void menu2() throws Exception {
        System.out.println("**********************************");
        System.out.println("请选择业务：");
        System.out.println("***  1. 航班业务    2. 客户业务  ***");
        System.out.println("**********************************");
        Scanner sc = new Scanner(System.in);
        int choice1 = sc.nextInt();
        switch (choice1) {
            case 1:
                planeMenu();
                break;
            case 2:
                customerMenu();
                break;
            default:
                System.out.println("业务尚未开发..........");
                System.out.println("请重新输入...........\n");
                menu1();
        }
    }
    public static void planeMenu() throws Exception {
        PlaneFunc planeFunc = new PlaneFuncImpl();

        System.out.println("**********************************");
        System.out.println("*********   航班业务菜单    ********");
        System.out.println("输入您的操作：");
//        System.out.println("***  1. 添加航班信息    2. 删除航班信息  ***");
        System.out.println("***  1. 添加航班信息    2. 返回上一菜单  ***");
        System.out.println("***  3. 查询航班信息    4. 修改航班信息  ***");
        System.out.println("***  5. 列出所有航班信息 6. 退出航班业务  ***");
        System.out.println("**********************************\n");
        Scanner sc = new Scanner(System.in);
        int choice = sc.nextInt();
        switch (choice) {
            case 1:
                System.out.println("添加航班信息");
                planeFunc.addPlaneInfo();
                planeFunc.showPlaneInfo(PlaneInfoSigleList.getPlaneInfos());
                planeMenu();
                break;
            case 2:
//                System.out.println("删除航班信息");
                menu2();
                break;
            case 3:
                System.out.println("查询航班信息");
                planeFunc.searchPlaneInfo();
                planeMenu();
                break;
            case 4:
                System.out.println("修改航班信息");
                //展示所有航班
                planeFunc.updatePlaneInfo();
                planeMenu();
                break;
            case 5:
                System.out.println("列出所有航班信息");
                planeFunc.showPlaneInfo(PlaneInfoSigleList.getPlaneInfos());
                planeMenu();
                break;
            case 6:
                System.out.println("退出航班业务");
                menu1();
                break;
            default:
                System.out.println("业务尚未开发..........");
                System.out.println("请重新输入...........\n");

        }

    }
    public static void customerMenu() throws Exception {
        CustomerFunc customerFunc = new CustomerFuncImpl();
        System.out.println("**********************************");
        System.out.println("*********   客户业务菜单    ********");
        System.out.println("输入您的操作：");
        System.out.println("***  1. 添加客户信息    2. 返回上一菜单  ***");
        System.out.println("***  3. 查询客户信息    4. 修改客户信息  ***");
        System.out.println("***  5. 列出所有客户信息 6. 退出客户业务  ***");
        System.out.println("**********************************\n");
        Scanner sc = new Scanner(System.in);
        int choice = sc.nextInt();
        switch (choice) {
            case 1:
                System.out.println("添加客户信息");
                customerFunc.addCustomerInfo();
                customerMenu();
                break;
            case 2:
                menu2();
                break;
            case 3:
                //查询客户信息
                customerFunc.searchCustomerInfo();
                customerMenu();
                break;
            case 4:
                System.out.println("修改客户信息");
                customerFunc.updateCustomerInfo();
                customerMenu();
                break;
            case 5:
                System.out.println("列出所有客户信息");
                customerFunc.showCustomerInfo(CustomerSigleList.getCustomerInfos());
                customerMenu();
                break;
            case 6:
                System.out.println("退出客户业务");
                menu1();
                break;
            default:
                System.out.println("业务尚未开发..........");
                System.out.println("请重新输入...........\n");
                customerMenu();
        }

    }
}
